package com.movie.ticket.sale.movieinterface.aheadcontroller;

import com.movie.ticket.sale.movieinterface.common.Result;
import com.movie.ticket.sale.movieinterface.dao.TOrderTicketMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.Map;

/**
 * @author： Micsal
 * @create-time： 2020.12.04 16:02
 * @version： 1.0
 * @description： 票务微服务
 */
@Api(tags = "票务(Ticket)", description = "订单查询，支付，退款，短信，座位，评论")
@RequestMapping("/ticket")
@RestController
public class MovieTicket {

    //========================== 订单查询 ==========================================================
    @ApiOperation("查询购票订单：验证权限，动态sql")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "pageSize", value = "每页展示的数量", dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "condition", value = "条件", dataType = "map", paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code = 200, response = Result.class, message = "成功,信息存放在data中"),
            @ApiResponse(code = 426, response = Result.class, message = "失败，信息存result.message中")
    })
    @GetMapping("/order/ticket/query")
    public static Result orderTicketQuery(int currentPage, int pageSize, Map<String, Object> condition) {
        /**
         * 验证权限
         * 设置条件
         * 查询
         */
        return null;
    }

    @ApiOperation("查询充值会员订单:验证权限，动态sql")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "pageSize", value = "每页展示的数量", dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "condition", value = "条件", dataType = "map", paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code = 200, response = Result.class, message = "成功,信息存放在data中"),
            @ApiResponse(code = 426, response = Result.class, message = "失败，信息存result.message中")
    })
    @GetMapping("/order/vip/query")
    public static Result orderVipQuery(int currentPage, int pageSize, Map<String, Object> condition) {
        /**
         *查询会员订单
         */
        return null;
    }

    @ApiOperation("查询年费缴纳订单：验证权限，动态sql")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "pageSize", value = "每页展示的数量", dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "condition", value = "条件", dataType = "map", paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code = 200, response = Result.class, message = "成功,信息存放在data中"),
            @ApiResponse(code = 426, response = Result.class, message = "失败，信息存result.message中")
    })
    @GetMapping("/order/annual/query")
    public static Result orderAnnualQuery(int currentPage, int pageSize, Map<String, Object> condition) {
        /**
         *查询会员订单
         */
        return null;
    }

    //========================= 支付 =================================================================
    @ApiOperation("发起支付")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "body", value = "商品描述", dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "tradeNo", value = "订单号", dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "subject", value = "订单名称", dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "totalAmount", value = "金额", dataType = "double", paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code = 200, response = Result.class, message = "成功,信息存放在data中"),
            @ApiResponse(code = 426, response = Result.class, message = "失败，信息存result.message中")
    })
    @PostMapping("/aliPay")
    public static Result aliPay(String body, String tradeNo, String subject, double totalAmount) {
        /**
         * 生成订单，发起支付
         */
        return null;
    }

    @ApiOperation("支付异步回调：处理订单")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "out_trade_no", value = "订单号", dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "trade_no", value = "简短订单号", dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "trade_status", value = "订单状态", dataType = "string", paramType = "query"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, response = Result.class, message = "成功,信息存放在data中"),
            @ApiResponse(code = 426, response = Result.class, message = "失败，信息存result.message中")
    })
    @RequestMapping("/aliPayNotifyUrl")
    public static Result aliPayNotifyUrl(HttpServletRequest request, String out_trade_no, String trade_no, String trade_status, HttpSession session) {
        return null;
    }

    @ApiOperation("支付同步回调：重定向")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "out_trade_no", value = "订单号", dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "trade_no", value = "简短订单号", dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "trade_status", value = "订单状态", dataType = "string", paramType = "query"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, response = Result.class, message = "成功,信息存放在data中"),
            @ApiResponse(code = 426, response = Result.class, message = "失败，信息存result.message中")
    })
    @RequestMapping("/aliPayReturnUrl")
    public static Result aliPayReturnUrl(HttpServletRequest request, String out_trade_no, String trade_no, String trade_status, HttpSession session) {
        return null;
    }

    //============================================ 评论 ============================================================
    @ApiOperation("添加评论")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "files", value = "图片", dataType = "file[]", paramType = "form"),
            @ApiImplicitParam(name = "score", value = "评分", dataType = "double[]", paramType = "form"),
            @ApiImplicitParam(name = "comment", value = "评论", dataType = "string", paramType = "form"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, response = Result.class, message = "成功,信息存放在data中"),
            @ApiResponse(code = 426, response = Result.class, message = "失败，信息存result.message中")
    })
    @PostMapping("/comment/add")
    public static Result addComment(MultipartFile[] files, double[] score,String comment) {
        /**
         * 添加评论
         */
        return null;
    }

    @ApiOperation("查询评论：用户、影院、boss")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "pageSize", value = "每页展示的数量", dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "condition", value = "条件", dataType = "map", paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code = 200, response = Result.class, message = "成功,信息存放在data中"),
            @ApiResponse(code = 426, response = Result.class, message = "失败，信息存result.message中")
    })
    @GetMapping("/comment/query")
    public static Result queryComment(int currentPage, int pageSize, Map<String, Object> condition) {
        /**
         * 验证权限
         * 验证身份
         * 查询评论
         */
        return null;
    }


    //========================= 投诉 ===========================================================================
    @ApiOperation("添加投诉")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "files", value = "图片", dataType = "file[]", paramType = "form"),
            @ApiImplicitParam(name = "score", value = "评分", dataType = "double[]", paramType = "form"),
            @ApiImplicitParam(name = "comment", value = "评论", dataType = "string", paramType = "form"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, response = Result.class, message = "成功,信息存放在data中"),
            @ApiResponse(code = 426, response = Result.class, message = "失败，信息存result.message中")
    })
    @PostMapping("/complain/add")
    public static Result addComplain(MultipartFile[] files, double[] score,String comment) {
        /**
         * 添加评论
         */
        return null;
    }

    @ApiOperation("查询投诉：用户、影院、boss")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "pageSize", value = "每页展示的数量", dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "condition", value = "条件", dataType = "map", paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code = 200, response = Result.class, message = "成功,信息存放在data中"),
            @ApiResponse(code = 426, response = Result.class, message = "失败，信息存result.message中")
    })
    @GetMapping("/complain/query")
    public static Result queryComplain(int currentPage, int pageSize, Map<String, Object> condition) {
        /**
         * 验证权限
         * 验证身份
         * 查询评论
         */
        return null;
    }

    //================================= 座位 ==========================================================
    @ApiOperation("影院添加座位")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "sets", value = "json格式座位信息", dataType = "string", paramType = "query"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, response = Result.class, message = "成功,信息存放在data中"),
            @ApiResponse(code = 426, response = Result.class, message = "失败，信息存result.message中")
    })
    @PostMapping("/set/add")
    public static Result addSet(String sets) {
        /**
         * 添加座位
         */
        return null;
    }

    @ApiOperation("展示座位")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "peridId", value = "场次id", dataType = "int", paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code = 200, response = Result.class, message = "成功,信息存放在data中"),
            @ApiResponse(code = 426, response = Result.class, message = "失败，信息存result.message中")
    })
    @GetMapping("/set/query")
    public static Result querySet(int peridId) {
        /**
         * 获取座位信息
         * 获取座位状态
         * 返回座位信息
         */
        return null;
    }
}
